<template>
  <div>
    <a-modal
      title="入库设置"
      :width="800"
      :confirm-loading="feeModalLoading"
      :mask-closable="false"
      :destroy-on-close="true"
      :visible="visible"
      @ok="onSaveFee()"
      @cancel="$emit('update:visible', false)"
    >
      <a-form-model layout="inline">
          
        
        <a-row style="margin-bottom:10px">
          <a-form-item  label="入库重量（kg）"  :labelCol="labelCol" :wrapperCol="wrapperCol" hasFeedback>
            <a-input class="search-input" type="number" v-model="harvest_weight" allowClear placeholder="请输入入库重量（kg）"></a-input>
          </a-form-item  :labelCol="labelCol" :wrapperCol="wrapperCol" hasFeedback>
        </a-row>
      
       <a-row>
          <a-form-item class="pay-checkbox"  label="入库图片" hasFeedback>
               <!-- 上传图片 -->
          <cyyUploadImg
            @uploadSuccess="
              (e) => {
                harvest_storage_pic_url = e.data
              }
            "
            @deleteImg="harvest_storage_pic_url = ''"
            :imgSrc="harvest_storage_pic_url"
          >
          </cyyUploadImg>
        </a-form-item>
       </a-row>
     
        
      </a-form-model>
    </a-modal>
  </div>
</template>

<script>


import {
  orderStorage
} from '@/api/adopt/order'
import { cyyUploadImg } from '@/components/CyyUi/index'

export default {
  components: {
        cyyUploadImg,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    orderId: {
      type: String,
      default: '',
    },
    orderInfo: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      feeModalLoading: false,
      harvest_weight: 0,
      harvest_storage_pic_url: '',
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
       console.log(this.orderInfo)
       if (this.orderInfo) {
          this.other_pick_fee = JSON.parse(this.orderInfo.other_pick_fee)
          this.preserve_fee = JSON.parse(this.orderInfo.preserve_fee)
       }
  },
  updated() {},
  methods: {
  
    onSaveFee() {
      var params = {
        order_id: this.orderId,
        harvest_weight: this.harvest_weight,
        harvest_storage_pic_url: this.harvest_storage_pic_url,
        is_storage: 1,
      }
      // const hide = this.$message.loading('操作中1...', 0)
      orderStorage(params)
        .then((res) => {
          if (res.code !== 0) {
            this.$error({
              content: res.msg,
            })
          } else {
            this.$message.success('设置成功')
            this.$emit('update:visible', false)
            this.$emit('onAfterClose')
          }
        })
        .catch((err) => {
          this.$message.error(err.message)
        })
    },
  },
}
</script>

<style scoped>
</style>